package com.digitalchina.lxnsy.viewholder;

import android.text.TextUtils;
import android.view.ViewGroup;
import android.widget.TextView;

import com.digitalchina.lxnsy.R;
import com.digitalchina.lxnsy.entity.MsgVO;
import com.digitalchina.lxnsy.toolkit.FrescoUtil;
import com.digitalchina.lxnsy.toolkit.StringUtil;
import com.facebook.drawee.view.SimpleDraweeView;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.viewholder
 * 创建人：byd
 * 创建时间：2017/3/24 18:02
 * 修改备注：
 * ================================================
 */

public class ExpertTypeHolder extends BaseViewHolder<MsgVO> {

    private SimpleDraweeView sdvImage;
    private TextView tvName;
    private TextView tvContent;

    public ExpertTypeHolder(ViewGroup parent) {
        super(parent, R.layout.item_type_expert_msg);
        sdvImage = $(R.id.item_type_expert_msg_sdv_image);
        tvName = $(R.id.item_type_expert_msg_tv_name);
        tvContent = $(R.id.item_type_expert_msg_tv_content);
    }

    @Override
    public void setData(MsgVO data) {
        super.setData(data);
        FrescoUtil.showImageSmall(TextUtils.isEmpty(data.getImage()) ? "" : data.getImage(), sdvImage);
        tvName.setText(TextUtils.isEmpty(data.getName()) ? "" : data.getName());
        if (data.getContent().contains("<a"))
            tvContent.setText(StringUtil.stripHtml(data.getContent()));
        else
            tvContent.setText(data.getContent());
    }
}
